package com.cnhis.cloudhealth.clinical.infusion.base.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.cnhis.cloudhealth.clinical.infusion.base.bo.MobileInfusionBo;
import com.cnhis.cloudhealth.commons.newid.GetNewId;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

/**
 * Created by hdd on 2016-11-02.
 */
@Service
public class MobileInfusionImpl implements IMobileInfusion{
    @Autowired
    private MobileInfusionBo mobileInfusionBo;
    @Autowired
    private GetNewId getNewId;
    /**
     * 查询病人列表信息 （输液待执行病人）
     * @param map
     * @return
     * @throws Exception
     */
    public Map<String, Object> query1476p(Map<String, Object> map) throws Exception{
        return mobileInfusionBo.query1476p(map);
    }

    /**
     * 查询病人列表信息 （输液 已完成  病人）
     * @param map
     * @return
     * @throws Exception
     */
    public Map<String, Object> findCompletedPatientList(Map<String, Object> map) throws Exception{
        return mobileInfusionBo.findCompletedPatientList(map);
    }

    /**
     * 查询病区 科室 信息
     * @return
     * @throws Exception
     */
    public Map<String, Object> queryDept() throws Exception{
        return mobileInfusionBo.queryDept();
    }

    /**
     * 根据 就诊id  查询此病人的详细信息
     * @param map
     * @return
     * @throws Exception
     */
    public Map<String, Object> queryDetailPatient(Map<String, Object> map) throws Exception{
        return mobileInfusionBo.queryDetailPatient(map);
    }

    /**
     * 获取病人  执行项目
     * 待执行病人  （进行中的 项目）
     * @param map
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    public Map<String,Object> queryExecutePro(Map<String, Object> map,int currPage, int pageSize)throws Exception{
        return mobileInfusionBo.queryExecutePro(map, currPage, pageSize);
    }

    /**
     * 获取病人  执行项目
     * 已完成  病人  （已完成的 项目）
     * @param map
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    public Map<String,Object> queryCompleteExecutePro(Map<String, Object> map,int currPage, int pageSize)throws Exception{
        return mobileInfusionBo.queryCompleteExecutePro(map, currPage, pageSize);
    }

    /**
     * 获取病人  执行记录   也就是项目的明细
     * @param map
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    public Map<String,Object> queryExecuteRecord(Map<String, Object> map,int currPage, int pageSize)throws Exception{
        return mobileInfusionBo.queryExecuteRecord(map, currPage, pageSize);
    }

    /**
     * 获取收费 记录
     * @param map
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    public Map<String,Object> queryChargeRecord(Map<String, Object> map,int currPage, int pageSize)throws Exception{
        return mobileInfusionBo.queryChargeRecord(map, currPage, pageSize);
    }


    /**
     * 查询所有  待执行医嘱  信息
     * @param map
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    public Map<String,Object> queryExcuseDoctor(Map<String, Object> map,int currPage, int pageSize)throws Exception{
        return mobileInfusionBo.queryExcuseDoctor(map, currPage, pageSize);
    }


    /**
     * 接单时  查询搜索的人员
     * 执行人  配药人  接单人
     * @return
     * @throws Exception
     */
    public Map<String,Object> queryUser(Map<String, Object> paraMap)throws Exception{
        return mobileInfusionBo.queryUser(paraMap);
    }

    /**
     * 保存接单 信息
     * member//会员类型   金卡2，普通卡1，钻石卡3
     * @return
     * @throws Exception
     */
    public String saveOrders(Map<String, Object> vbj1_map ,/**病人医嘱执行  基本信息**/
                             List<Map<String, Object>> vaf1_list,  /**病人医嘱记录  list表格**/
                             Map<String, Object> userMap, String vaa01, int member, String vaa07
    )throws Exception{
        return mobileInfusionBo.saveOrders(vbj1_map,vaf1_list,userMap,vaa01,member,vaa07);
    }


    /**
     *  查询  输液单，注射单 等 各个单据  用于打印
     * @return
     * @throws Exception
     */
    public Map<String,Object> querySingleinfusion(Map<String, Object> paramMap)throws Exception{
        return mobileInfusionBo.querySingleinfusion(paramMap);
    }

    /**
     * 点击执行完成 的操作
     * @param paramMap
     * @return
     * @throws Exception
     */
    public String performOver(List<Map<String, Object>> cbmAndVaf_list)throws Exception{
        return mobileInfusionBo.performOver(cbmAndVaf_list);
    }

    /**
     * 退费审核
     * @param paramMap
     * @return
     * @throws Exception
     */
    public Map<String,Object> queryRefundAudit(Map<String, Object> paramMap,int currPage, int pageSize)throws Exception{
        return mobileInfusionBo.queryRefundAudit(paramMap, currPage, pageSize);
    }

    /**
     * 退费审核中的 人员搜索
     * @param paramMap
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    public Map<String,Object> queryUserInRefundAudit(Map<String, Object> paramMap,int currPage, int pageSize)throws Exception{
        return mobileInfusionBo.queryUserInRefundAudit(paramMap, currPage, pageSize);
    }

    /**
     * 根据科室查询  此科室下的所有人员
     * 退费审核
     * @param paramMap
     * @return
     * @throws Exception
     */
    public Map<String,Object> refundAuditByDepId(Map<String, Object> paramMap,int currPage, int pageSize)throws Exception{
        return mobileInfusionBo.refundAuditByDepId(paramMap, currPage, pageSize);
    }

    /**
     * 点击皮试结果
     * @param paramMap
     * @return
     * @throws Exception
     */
    public Map<String,Object> skinTest(Map<String, Object> paramMap)throws Exception{
        return mobileInfusionBo.skinTest(paramMap);
    }


    /**
     * 基本信息 保存皮试前使用
     * @param paramMap
     * @return
     * @throws Exceptio
     */
    public List queryBaseInfo(Map<String, Object> paramMap)throws Exception{
        return mobileInfusionBo.queryBaseInfo(paramMap);
    }

    /**
     * 皮试的修改
     * 保存皮试信息   更新vaf
     * @param paramMap
     * @throws Exception
     */
    public void saveSkinTestResult(Map<String, Object> paramMap)throws Exception{
        mobileInfusionBo.saveSkinTestResult(paramMap);
    }

    /**
     * 查询是否具有过敏记录
     * @param paramMap
     * @return
     * @throws Exception
     */
    public List queryIsHasSkinRecord(Map<String, Object> paramMap)throws Exception{
        return mobileInfusionBo.queryIsHasSkinRecord(paramMap);
    }

    /**
     * 添加过敏记录
     * @param paramMap
     * @throws Exception
     */
    public void addSkinRecord(Map<String, Object> paramMap)throws Exception{
        paramMap.put("van01",getNewId.nextId());
        mobileInfusionBo.addSkinRecord(paramMap);
    }

    /**
     * 修改过敏记录
     * @param paramMap
     * @throws Exception
     */
    public void updateSkinRecord(Map<String, Object> paramMap)throws Exception{
        mobileInfusionBo.updateSkinRecord(paramMap);
    }

    /**
     * 查询是否具有过敏药物
     * @param paramMap
     * @return
     * @throws Exception
     */
    public List queryIsHasSkinDrug(Map<String, Object> paramMap)throws Exception{
        return mobileInfusionBo.queryIsHasSkinDrug(paramMap);
    }

    /**
     * 添加过敏药物
     * @param paramMap
     * @throws Exception
     */
    public void addSkinDrug(Map<String, Object> paramMap)throws Exception{
        paramMap.put("val01",getNewId.nextId());
        mobileInfusionBo.addSkinDrug(paramMap);
    }


    /**
     * 退费审核的保存
     * @param map
     * @return
     * @throws Exception
     */
    public Map<String, Object> refund(Map<String, Object> map) throws Exception {
        return mobileInfusionBo.refund(map);
    }

    /**
     * 根据 vaf01  查询vbj表  查询出  执行时间 vaj08  用于打印
     * @param vaf01
     * @return
     * @throws Exception
     */
    public Map<String, Object> queryVaj08ByVaf01(Map<String, Object> paramMap)throws Exception{
        return mobileInfusionBo.queryVaj08ByVaf01(paramMap);
    }

    /**
     * 查询病人 是不是会员
     * @throws Exception
     */
    public Map<String,Object> findMembers(String vaa01)throws Exception{
        return mobileInfusionBo.findMembers(vaa01);
    }

    /**
     * 查询病人 会员卡类型
     */
    public Map<String,Object> findMemberCardType(String vaa01)throws Exception{
        return mobileInfusionBo.findMemberCardType(vaa01);
    }


    /**
     * 根据 科室 和  vaf01 查询是否可以申请  是本科室给药途径退费
     * @return
     * @throws Exception
     */
    public Map<String,Object> queryApplyRefuse(Map<String, Object> paramMap)throws Exception{
        return mobileInfusionBo.queryApplyRefuse(paramMap);
    }

    /**
     * 配液执行完成的操作
     * @param paramMap
     * @return
     * @throws Exception
     */
    public String technicExecToComplete(Map<String, Object> paramMap)throws Exception{
        return mobileInfusionBo.technicExecToComplete(paramMap);
    }


    /**
     * 确认执行穿刺
     * @param paramMap
     * @return
     * @throws Exception
     */
    public String ohmobilesyworkinsert(Map<String, Object> paramMap)throws Exception{
        return mobileInfusionBo.ohmobilesyworkinsert(paramMap);
    }

    /**
     * 判断是输液是否已经开始了  Mobile_SY_WORK
     * @param paramMap
     * @return
     * @throws Exception
     */
    public List checkInfusionStart(Map<String,Object> paramMap)throws Exception{
        return mobileInfusionBo.checkInfusionStart(paramMap);
    }

    /**
     * 查询 oldvbi21  是否正在输液
     * @param paramMap
     * @return
     * @throws Exception
     */
    public String queryoldVBI21(Map<String,Object> paramMap) throws Exception{
        return mobileInfusionBo.queryoldVBI21(paramMap);
    }

    /**
     * 判断是否已经输液完成
     * @param paramMap
     * @return
     * @throws Exception
     */
    public List checkInfusionEnd(Map<String,Object> paramMap)throws Exception{
        return mobileInfusionBo.checkInfusionEnd(paramMap);
    }

    /**
     * 不换瓶子 的保存方法
     * @param paramMap
     * @throws Exception
     */
    public void insertSywFlg0(Map<String,Object> paramMap)throws Exception{
        mobileInfusionBo.insertSywFlg0(paramMap);
    }



}
